//
// Created by 吕凌 on 2018/4/11.
// Copyright (c) 2018 吕凌. All rights reserved.
//

import Foundation

class Callback {

    static var callbackMap: Dictionary = Dictionary<String, WXModuleKeepAliveCallback>()

    static func on(key: String, callback: @escaping WXModuleKeepAliveCallback) {
        callbackMap[key] = callback
    }

    static func fire(key: String, params: NSDictionary) {
        if((callbackMap[key]) != nil) {
            callbackMap[key]!(params, false)
            callbackMap.removeValue(forKey: key)
        }
    }
}
